# -*- coding: utf-8 -*-
__author__ = 'BuddyHolly'

from pptx import Presentation
from app.src.imgsave.curPic import CurPic
from app.src.imgsave.infoPic import InfoPic


# ====================
# *** 图片批量存取类 ***
# ====================

def save_pic(filepath, savepath):
    ppt_path = str(filepath)
    curpic_path = str(savepath)
    prs = Presentation(ppt_path)
    info = InfoPic(ppt_path)
    # 调用InfoPic提取所有图片信息
    infolists = info.get_info()
    name_list = []
    for infolist in infolists:
        # 调用CurPic存储图片
        currentpic = CurPic(prs, infolist, curpic_path)
        currentpic.get_pic()
        name_list.append(currentpic.file_name)
    # 返回所有存取的文件名列表
    return name_list
